package com.kedacom.freedomLabel.adapter;

import android.databinding.ViewDataBinding;
import android.graphics.Color;
import android.support.annotation.Nullable;

import com.kedacom.freedomLabel.R;
import com.kedacom.freedomLabel.databinding.SettingItemLayoutBinding;
import com.kedacom.freedomLabel.model.bean.SettingItem;
import com.kedacom.lego.adapter.recyclerview.LegoBaseRecyclerViewAdapter;

import java.util.List;

/**
 * @author licheng
 * @since 2019/8/1 14:18
 */
public class SettingItemAdapter extends LegoBaseRecyclerViewAdapter<SettingItem> {

    public SettingItemAdapter(@Nullable List<SettingItem> data) {
        super(R.layout.setting_item_layout, data, com.kedacom.freedomLabel.BR.item);
    }

    @Override
    protected void onCustomBindItem(ViewDataBinding binding, int position) {
        SettingItemLayoutBinding itemBinding = (SettingItemLayoutBinding) binding;
        int size = getData().size();
        if (position == size - 1) {
            itemBinding.settingItemLinear.setBackgroundResource(R.drawable.bg_press_red);
            itemBinding.settingItemName.setTextColor(Color.WHITE);
        }
    }
}